using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Drawing;
using System.Windows.Forms;

namespace Jonathan
{
	/// <summary>
	/// Class that Holds all of the Options for Jonathan.
	/// </summary>
    [Serializable]
    public class cJData
    {
        private Size m_Size;
        private Point m_Location;
        private bool m_MouseOver;
        private bool m_SaveOnExit;
        private bool m_AskOnExit;
        private bool m_SelWordOnClick;
        private string m_DefaultBible;
        private string m_DefaultDaily;
        private string m_TabLayoutFile;
        private SFont m_Font;
        private icDBInfo m_TSK;
        private FormWindowState m_WindowState;
        private List<icDBInfo> m_BibleDatabases;
        private List<icDBInfo> m_ReferenceDatabases;
        private List<icDBInfo> m_OtherDatabases;
        private List<icDBInfo> m_DailyDatabases;
        private List<cPassage> m_BookMarks;
        private icReaderOptions m_ReaderOptions;

        /// <summary>
        /// Gets or Sets the Default Bible...
        /// </summary>
        [XmlElement]
        public string DefaultBible
        {
            get { return this.m_DefaultBible; }
            set { this.m_DefaultBible = value; }
        }

        /// <summary>
        /// Gets or Sets the Default Font...
        /// </summary>
        [XmlElement]
        public SFont DefaultFont
        {
            get { return this.m_Font; }
            set { this.m_Font = value; }
        }

        /// <summary>
        /// Gets or Sets the Tab Layout File Path...
        /// </summary>
        [XmlElement]
        public string TabLayoutFile
        {
            get { return this.m_TabLayoutFile; }
            set { this.m_TabLayoutFile = value; }
        }

        /// <summary>
        /// Gets or Sets the Default Daily...
        /// </summary>
        [XmlElement]
        public string DefaultDaily
        {
            get { return this.m_DefaultDaily; }
            set { this.m_DefaultDaily = value; }
        }

        /// <summary>
        /// Gets or Sets to show tool tips on mouse over...
        /// </summary>
        [XmlElement]
        public bool MouseOverToolTips
        {
            get { return this.m_MouseOver; }
            set { this.m_MouseOver = value; }
        }

        /// <summary>
        /// Gets or Sets a List of Bible Databases...
        /// </summary>
        public List<icDBInfo> BibleDatabases
        {
            get { return this.m_BibleDatabases; }
            set { this.m_BibleDatabases = value; }
        }

        /// <summary>
        /// Gets or Sets a List of Reference Databases...
        /// </summary>
        public List<icDBInfo> ReferenceDatabases
        {
            get { return this.m_ReferenceDatabases; }
            set { this.m_ReferenceDatabases = value; }
        }

        /// <summary>
        /// Gets or Sets a List of Other Databases...
        /// </summary>
        public List<icDBInfo> OtherDatabases
        {
            get { return this.m_OtherDatabases; }
            set { this.m_OtherDatabases = value; }
        }

        /// <summary>
        /// Gets or Sets a List of Daily Databases...
        /// </summary>
        public List<icDBInfo> DailyDatabases
        {
            get { return this.m_DailyDatabases; }
            set { this.m_DailyDatabases = value; }
        }

        /// <summary>
        /// Gets or Sets a List of Book Marks...
        /// </summary>
        public List<cPassage> BookMarks
        {
            get { return this.m_BookMarks; }
            set { this.m_BookMarks = value; }
        }

        /// <summary>
        /// Gets or Sets the Reader Options...
        /// </summary>
        public icReaderOptions ReaderOptions
        {
            get { return this.m_ReaderOptions; }
            set { this.m_ReaderOptions = value; }
        }

        /// <summary>
        /// Gets or Sets the Information for the TSK...
        /// </summary>
        [XmlElement]
        public icDBInfo TSK
        {
            get { return this.m_TSK; }
            set { this.m_TSK = value; }
        }

        /// <summary>
        /// Gets or Sets if we should save layout on exit or not...
        /// </summary>
        [XmlElement]
        public bool SaveLayoutOnExit
        {
            get { return this.m_SaveOnExit; }
            set { this.m_SaveOnExit = value; }
        }

        /// <summary>
        /// Gets or Sets if we should ask to save layout on exit or not...
        /// </summary>
        [XmlElement]
        public bool AskSaveLayoutOnExit
        {
            get { return this.m_AskOnExit; }
            set { this.m_AskOnExit = value; }
        }

        /// <summary>
        /// Gets or Sets if we should select the clicked word...
        /// </summary>
        [XmlElement]
        public bool SelectWordOnClick
        {
            get { return this.m_SelWordOnClick; }
            set { this.m_SelWordOnClick = value; }
        }

        /// <summary>
        /// Gets or Sets the Window State on closing...
        /// </summary>
        [XmlElement]
        public FormWindowState WindowState
        {
            get { return this.m_WindowState; }
            set { this.m_WindowState = value; }
        }

        /// <summary>
        /// Gets or Sets the Location of the Program...
        /// </summary>
        [XmlElement]
        public Point Location
        {
            get { return this.m_Location; }
            set { this.m_Location = value; }
        }

        /// <summary>
        /// Gets or Sets the Size of the Program...
        /// </summary>
        [XmlElement]
        public Size Size
        {
            get { return this.m_Size; }
            set { this.m_Size = value; }
        }

		/// <summary>
		/// Options for Reader Controls.
		/// </summary>
        [Serializable]
        public class icReaderOptions
        {
            private bool m_ShowBorder;
            private bool m_HighLiteRows;

            /// <summary>
            /// Gets or Sets if Borders will be shown in the reader...
            /// </summary>
            [XmlElement]
            public bool ShowBorder
            {
                get { return this.m_ShowBorder; }
                set { this.m_ShowBorder = value; }
            }

            /// <summary>
            /// Gets or Sets if the Rows will be highlighted on mouse over...
            /// </summary>
            [XmlElement]
            public bool HighlightRows
            {
                get { return this.m_HighLiteRows; }
                set { this.m_HighLiteRows = value; }
            }
        }

		/// <summary>
		/// A Serializable Font Object.
		/// </summary>
        [Serializable]
        public class SFont
        {
            private string m_Name;
            private float m_Size;
            private FontStyle m_Style;

            /// <summary>
            /// Creates a new Serializable Font Class...
            /// </summary>
            public SFont ()
            {
                this.m_Name = SystemFonts.DefaultFont.Name;
                this.m_Size = SystemFonts.DefaultFont.Size;
                this.m_Style = SystemFonts.DefaultFont.Style;
            }

            /// <summary>
            /// Creates a new Serializable Font Class...
            /// </summary>
            /// <param name="f">Font to copy.</param>
            public SFont (Font f)
            {
                this.m_Name = f.Name;
                this.m_Size = f.Size;
                this.m_Style = f.Style;
            }

            /// <summary>
            /// Creates a new Serializable Font Class...
            /// </summary>
            /// <param name="name">Name of the Font.</param>
            /// <param name="size">Size of the Font.</param>
            /// <param name="style">Style of the Font.</param>
            public SFont (string name, float size, FontStyle style)
            {
                this.m_Name = name;
                this.m_Size = size;
                this.m_Style = style;
            }

            /// <summary>
            /// Gets or Sets the Name of the Font...
            /// </summary>
            [XmlAttribute]
            public string Name
            {
                get { return this.m_Name; }
                set { this.m_Name = value; }
            }

            /// <summary>
            /// Gets or Sets the Size of the Font...
            /// </summary>
            [XmlAttribute]
            public float Size
            {
                get { return this.m_Size; }
                set { this.m_Size = value; }
            }

            /// <summary>
            /// Gets or Sets the Style of the Font...
            /// </summary>
            [XmlAttribute]
            public FontStyle Style
            {
                get { return this.m_Style; }
                set { this.m_Style = value; }
            }

            /// <summary>
            /// Gets this SFont as a Font...
            /// </summary>
            /// <returns>Font.</returns>
            public Font ToFont ()
            {
                return new Font(this.Name, this.Size, this.Style);
            }
        }

		/// <summary>
		/// A Class that Hold Info about a Database.
		/// </summary>
        [Serializable]
        public class icDBInfo
        {
            private string m_Path;
            private string m_Name;

            /// <summary>
            /// Creates a new icDBInfo...
            /// </summary>
            public icDBInfo ()
            {
                this.m_Name = "";
                this.m_Path = "";
            }

            /// <summary>
            /// Creates a new icDBInfo with the given information...
            /// </summary>
            /// <param name="path">Path to Database.</param>
            /// <param name="name">Name of Database.</param>
            public icDBInfo (string path, string name)
            {
                this.m_Name = name;
                this.m_Path = path;
            }

            /// <summary>
            /// Gets or Sets the Path to the Database...
            /// </summary>
            [XmlAttribute]
            public string Path
            {
                get { return this.m_Path; }
                set { this.m_Path = value; }
            }

            /// <summary>
            /// Gets or Sets the Name of the Database...
            /// </summary>
            [XmlAttribute]
            public string Name
            {
                get { return this.m_Name; }
                set { this.m_Name = value; }
            }
        }
    }
}
